package com.doordu.framework.cloud.xxl;

import com.doordu.framework.cloud.xxl.executor.DoorduJobExecutor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author zxw
 * @date 2020/9/22 23:56
 */
public class DoorduJobExecutorFactory {
    private static final Log log = LogFactory.getLog(DoorduJobExecutorFactory.class);

    public DoorduJobExecutor create(DoorduJobInstanceConfig doorduJobInstanceConfig) {
        DoorduJobExecutor.Builder builder = DoorduJobExecutor.Builder.newBuilder();
        builder.setAppName(doorduJobInstanceConfig.getAppName());
        builder.setAccessToken(doorduJobInstanceConfig.getAccessToken());
        builder.setAdminAddresses(doorduJobInstanceConfig.getAdminAddresses());
        builder.setIp(doorduJobInstanceConfig.getHost());
        builder.setLogPath(doorduJobInstanceConfig.getLogPath());
        builder.setLogRetentionDays(doorduJobInstanceConfig.getLogRetentionDays());
        builder.setPort(doorduJobInstanceConfig.getPort());
        return builder.build();
    }
}
